package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Address;
import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface addressMapper extends BaseMapper<Address> {
    @Select("INSERT into address(username,name,phone,address) values (#{username},#{name},#{phone},#{address})")
    Object addaddress(String username,String name,String phone,String address);

    @Select("SELECT a.username,a.name,a.id,a.phone,a.address from address a where a.username = #{username} ")
    List<Address> findaddress(String username);

    @Select("DELETE FROM address where id = #{id}")
    Object delete(int id);
}
